package com.ianmoone.JZOF;

import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Scanner;

public class XCTest4 {
	@SuppressWarnings("unchecked")
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		in.nextLine();
		int[] a = new int[n];
		List<Integer> list = new LinkedList<>();
		Map<Integer, Integer> map = new LinkedHashMap(n,0.75f,true){
			@Override
			protected boolean removeEldestEntry(java.util.Map.Entry eldest) {
				// TODO Auto-generated method stub
				return size() > n;
			}
		};
		
		while (in.hasNextLine()) {
			String string = in.nextLine();
			String[] split = string.split(" ");
			String func = split[0];
			if (func.equals("p")) {
				int key = Integer.valueOf(split[1]);
				int value = Integer.valueOf(split[2]);
				map.put(key, value);
			}else if (func.equals("g")) {
				int key = Integer.valueOf(split[1]);
				System.out.println(map.get(key));
			}
		}
	}
}
